<template>
  <!-- hvps141明细-->
  <el-dialog
    title="大额延迟结算回执录入审核明细"
    center
    :visible.sync="openState"
    width="1024px"
    :close-on-click-modal="false"
  >
    <el-form ref="form" :model="form" label-width="158px">
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="交易流水号" prop="id">
            <el-input v-model="form.id" disabled/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="原报文标识号" prop="oripkgid">
            <el-input v-model="form.oripkgid" disabled/>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="CPG日期" prop="vdate">
            <el-date-picker v-model="form.vdate" style="width: 100%;" type="date" value-format="yyyyMMdd" disabled/>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="工作日期" prop="workdate">
            <el-date-picker v-model="form.workdate" style="width: 100%;" type="date" value-format="yyyyMMdd" disabled/>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="来源" prop="source">
            <el-select style="width: 100%;" v-model="form.source" placeholder="来源" disabled>
              <el-option
                v-for="dict in dictMap.TXN_SOURCE"
                :key="dict.value"
                :label="`${dict.value}-${dict.text}`"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="原业务发起参与者行号" prop="oriSender">
            <el-input v-model="form.oriSender" disabled/>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="原业务接收参与者行号" prop="oriReciver">
            <el-input v-model="form.oriReciver" disabled/>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="业务类型" prop="bizTypeCode">
            <el-select style="width: 100%;"
                       v-model="form.bizTypeCode===null||form.bizTypeCode===undefined?'':form.bizTypeCode+'-'+form.bizTypeCodeDesc"
                       placeholder="业务类型" :disabled="true"
            >

            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="业务种类" prop="bizCtgyCode">
            <el-select style="width: 100%;"
                       v-model="form.bizCtgyCode===null||form.bizCtgyCode===undefined?'':form.bizCtgyCode+'-'+form.bizCtgyCodeDesc"
                       placeholder="业务种类" :disabled="true"
            >

            </el-select>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="业务回执状态" prop="procStatus">
            <el-select style="width: 100%;" v-model="form.procStatus" placeholder="业务回执状态" disabled>
              <el-option
                v-for="dict in dictMap.BIZRT_STATUS_117"
                :key="dict.value"
                :label="`${dict.value}-${dict.text}`"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="业务拒绝处理码" prop="bizRejectCode">
            <el-select style="width: 100%;"
                       v-model="form.bizRejectCode===null||form.bizRejectCode===undefined?'':form.bizRejectCode+'-'+form.bizRejectCodeDesc"
                       placeholder="业务拒绝处理码" :disabled="true"
            >

            </el-select>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row type="flex">
        <el-col :span="24">
          <el-form-item label="业务回执信息" prop="procInfo">
            <el-input type="textarea" v-model="form.procInfo" disabled/>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="录入操作员" prop="mdTlrno">
            <el-input v-model="form.mdTlrno" disabled/>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="录入时间" prop="mdTime">
            <el-date-picker style="width: 100%;" v-model="form.mdTime" value-format="yyyyMMddHHmmss"
                            type="datetime" disabled
            />
          </el-form-item>
        </el-col>
      </el-row>

      <el-row type="flex">
        <el-col :span="24">
          <el-form-item label="审核附言" prop="AudRemarks">
            <el-input type="textarea" v-model="form.AudRemarks"  maxlength="128" show-word-limit />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="approveFn" :loading="isLoading">审 核</el-button>
      <el-button type="danger" @click="rejectFn" :loading="isLoading">拒 绝</el-button>
      <el-button @click="handleClose">关 闭</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { approve4, reject4 } from "@/api/cnaps/baseBiz/send/check/creditCheck";
import HtAmountInput from "@/views/components/HtAmountInput";
import HtAmountUpper from "@/views/components/HtAmountUpper";
import QueryDetailInterInfo from "@/views/cnaps/baseBiz/send/components/queryDetailInterInfo";
import ClearAccountQuery from "@/views/cnaps/saps/otherCommQuery/352/clear_account_query";

export default {
  name: "QueryDetailDialog",
  components: {
    ClearAccountQuery,
    HtAmountInput,
    HtAmountUpper,
    QueryDetailInterInfo,
  },
  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
    form: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      busTypeList: [],
      id: "",
      pkgNo: "",
      isLoading: false,
      // 是否显示弹出层
      openState: false,
      rules: {
        returnStatus: [{ required: true, message: "请输入回执状态", trigger: "blur" }],
      },
    };
  },
  mounted() {},
  methods: {
    show() {
      this.openState = true;
    },
    // 关闭回掉
    handleClose() {
      this.openState = false;
    },
    // 表单重置
    reset() {
      this.resetForm("editForm");
      this.$set(this, "form", {});
    },
    cancel() {
      this.openState = false;
      this.reset();
      this.$emit("editComplete", false);
    },
    /** TODO提交按钮 */
    approveFn: function () {
      this.isLoading = true;
      //如果有ID 则是修改
      //this.form.userInfo = { brno: "676", userId: "cpg001" };
      approve4(this.form).then((res) => {
        this.isLoading = false;
        this.msgSuccess("审核成功");
        this.$emit("editComplete", true);
        this.openState = false;
      }).catch(error => {
        this.isLoading = false;
      });
    },
    rejectFn: function () {
      this.isLoading = true;
      //如果有ID 则是修改
      //this.form.userInfo = { brno: "676", userId: "cpg001" };
      reject4(this.form).then((res) => {
        this.isLoading = false;
        this.msgSuccess("拒绝成功");
        this.$emit("editComplete", true);
        this.openState = false;
      }).catch(error => {
        this.isLoading = false;
      });
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}
</style>
